import { Injectable, Logger } from '@nestjs/common';
import { InjectRepository } from '@nestjs/typeorm';
import { Repository } from 'typeorm';
import { ConfigService } from '@nestjs/config';
import { BaseService } from '@wwjCommon/base/base.service';
import { CacheService } from '@wwjCommon/cache/cache.service';
import { LoggingService } from '@wwjCommon/logging/logging.service';
import { UploadService } from '@wwjVendor/upload/upload.service';
import { PayService } from '@wwjVendor/pay/pay.service';
import { SmsService } from '@wwjVendor/sms/sms.service';
import { NoticeService } from '@wwjVendor/notice/notice.service';

@Injectable()
export class SiteStatService extends BaseService<any> {
  private readonly logger = new Logger(SiteStatService.name);

  constructor(
    @InjectRepository(Object)
    protected readonly repository: Repository<any>,
    private readonly cacheService: CacheService,
    private readonly configService: ConfigService,
    private readonly loggingService: LoggingService,
    private readonly uploadService: UploadService,
    private readonly payService: PayService,
    private readonly smsService: SmsService,
    private readonly noticeService: NoticeService,
  ) {
    super(repository);
  }

  /**
   * getIndexData
   * 对应 PHP: SiteStatService_admin::getIndexData()
   * 逻辑类型: undefined - undefined
   */
  async getIndexData() {
    // 基于PHP真实逻辑: getIndexData
    // PHP原文: $data = [             'site_info' => '',          ];         $data[ 'site_info' ] = ( new SiteService() )->getInfo($this->site_id);         $site_crea...
const data = [
            site_info: '',

        ];
        data[ 'site_info' ] = ( this.siteService ).getInfo(this.site_id];
        const site_create_time = strtotime(data[ 'site_info' )[ 'create_time' )];
        const site_expire_time = strtotime(data[ 'site_info' )[ 'expire_time' )];
        data[ 'site_info' ][ 'mix' ] = ( number_format(( time() - site_create_time ) / ( site_expire_time - site_create_time ), 2) * 100 )  + '%';
        data[ 'site_info' ][ 'over_date' ] = site_expire_time - time() > 0 ? number_format(( site_expire_time - time() ) / 86400, 2) : 0;

        return data;
    }

}
  }
}
